home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 April: Mac OS SDK / Dev.CD Apr 00 SDK1.toast / Development Kits / Mac OS / Open Transport 1.3 / Open Transport SDK / Open Tpt Module Developer / TempSystemIncludes / Devices.h next >
Encoding:
C/C++ Source or Header  |  1998-04-30  |  22.6 KB  |  629 lines  |  [TEXT/MPS ]

  1. /*
  2.     File:        NewDevices.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Copyright:    © 1997 by Apple Computer, Inc., all rights reserved.
  7.  
  8. */
  9.  
  10. /*
  11.      File:        Devices.h
  12.  
  13.      Contains:    Device Manager interfaces
  14.  
  15.      Version:    Technology:    
  16.                  Package:    Universal Interfaces  DDK v21c1.  Friday, March 31, 1995.
  17.  
  18.      Copyright:    © 1984-1997 by Apple Computer, Inc.
  19.                  All rights reserved.
  20.  
  21.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  22.                  stack.  Include the file and version information (from above)
  23.                  in the problem description and send to:
  24.                      Internet:    apple.bugs@applelink.apple.com
  25.                      AppleLink:    APPLE.BUGS
  26.  
  27. */
  28.  
  29. #ifndef __DEVICES__
  30. #define __DEVICES__
  31.  
  32.  
  33. #ifndef __OSUTILS__
  34. #include <OSUtils.h>
  35. #endif
  36. /*    #include <Types.h>                                            */
  37. /*        #include <ConditionalMacros.h>                            */
  38. /*    #include <MixedMode.h>                                        */
  39. /*    #include <Memory.h>                                            */
  40.  
  41. #ifndef __FILES__
  42. #include <Files.h>
  43. #endif
  44.  
  45. #ifndef __QUICKDRAW__
  46. #include <Quickdraw.h>
  47. #endif
  48. /*    #include <QuickdrawText.h>                                    */
  49.  
  50. #ifndef __EVENTS__
  51. #include <Events.h>
  52. #endif
  53.  
  54. #ifndef __DIALOGS__
  55. #include <Dialogs.h>
  56. #endif
  57. /*    #include <Errors.h>                                            */
  58. /*    #include <Windows.h>                                        */
  59. /*        #include <Controls.h>                                    */
  60. /*            #include <Menus.h>                                    */
  61. /*    #include <TextEdit.h>                                        */
  62.  
  63. /* #ifndef __KERNEL__                                            */
  64. /* #include <Kernel.h>                                            */
  65. /* #endif                                                        */
  66. /*    #include <MachineExceptions.h>                                */
  67.  
  68. #ifndef __NAMEREGISTRY__
  69. #include <NameRegistry.h>
  70. #endif
  71.  
  72. #ifndef __CODEFRAGMENTS__
  73. #include <CodeFragments.h>
  74. #endif
  75.  
  76. #ifdef __cplusplus
  77. extern "C" {
  78. #endif
  79.  
  80. #if GENERATINGPOWERPC
  81. #pragma options align=mac68k
  82. #endif
  83.  
  84. #ifdef __CFM68K__
  85. #pragma import on
  86. #endif
  87.  
  88.  
  89. enum {
  90.     chooserInitMsg                = 11,                            /* the user selected this device package */
  91.     newSelMsg                    = 12,                            /* the user made new device selections */
  92.     fillListMsg                    = 13,                            /* fill the device list with choices */
  93.     getSelMsg                    = 14,                            /* mark one or more choices as selected */
  94.     selectMsg                    = 15,                            /* the user made a selection */
  95.     deselectMsg                    = 16,                            /* the user canceled a selection */
  96.     terminateMsg                = 17,                            /* allows device package to clean up */
  97.     buttonMsg                    = 19                            /* the user selected a button */
  98. };
  99.  
  100. /* Values of the 'caller' parameter to a Chooser device package */
  101. enum {
  102.     chooserID                    = 1
  103. };
  104.  
  105. /* Values of the 'message' parameter to a Control Panel 'cdev' */
  106. enum {
  107.     initDev                        = 0,                            /*Time for cdev to initialize itself*/
  108.     hitDev                        = 1,                            /*Hit on one of my items*/
  109.     closeDev                    = 2,                            /*Close yourself*/
  110.     nulDev                        = 3,                            /*Null event*/
  111.     updateDev                    = 4,                            /*Update event*/
  112.     activDev                    = 5,                            /*Activate event*/
  113.     deactivDev                    = 6,                            /*Deactivate event*/
  114.     keyEvtDev                    = 7,                            /*Key down/auto key*/
  115.     macDev                        = 8,                            /*Decide whether or not to show up*/
  116.     undoDev                        = 9,
  117.     cutDev                        = 10,
  118.     copyDev                        = 11,
  119.     pasteDev                    = 12,
  120.     clearDev                    = 13,
  121.     cursorDev                    = 14
  122. };
  123.  
  124. /* Special values a Control Panel 'cdev' can return */
  125. enum {
  126.     cdevGenErr                    = -1,                            /*General error; gray cdev w/o alert*/
  127.     cdevMemErr                    = 0,                            /*Memory shortfall; alert user please*/
  128.     cdevResErr                    = 1,                            /*Couldn't get a needed resource; alert*/
  129.     cdevUnset                    = 3                                /* cdevValue is initialized to this*/
  130. };
  131.  
  132. /* Values of the 'message' parameter to a Monitor 'mntr' */
  133. enum {
  134.     initMsg                        = 1,                            /*initialization*/
  135.     okMsg                        = 2,                            /*user clicked OK button*/
  136.     cancelMsg                    = 3,                            /*user clicked Cancel button*/
  137.     hitMsg                        = 4,                            /*user clicked control in Options dialog*/
  138.     nulMsg                        = 5,                            /*periodic event*/
  139.     updateMsg                    = 6,                            /*update event*/
  140.     activateMsg                    = 7,                            /*not used*/
  141.     deactivateMsg                = 8,                            /*not used*/
  142.     keyEvtMsg                    = 9,                            /*keyboard event*/
  143.     superMsg                    = 10,                            /*show superuser controls*/
  144.     normalMsg                    = 11,                            /*show only normal controls*/
  145.     startupMsg                    = 12                            /*code has been loaded*/
  146. };
  147.  
  148. /* control codes for DeskAccessories */
  149. enum {
  150.     goodbye                        = -1,                            /* heap being reinitialized */
  151.     killCode                    = 1,                            /* KillIO requested */
  152.     accEvent                    = 64,                            /* handle an event */
  153.     accRun                        = 65,                            /* time for periodic action */
  154.     accCursor                    = 66,                            /* change cursor shape */
  155.     accMenu                        = 67,                            /* handle menu item */
  156.     accUndo                        = 68,                            /* handle undo command */
  157.     accCut                        = 70,                            /* handle cut command */
  158.     accCopy                        = 71,                            /* handle copy command */
  159.     accPaste                    = 72,                            /* handle paste command */
  160.     accClear                    = 73                            /* handle clear command */
  161. };
  162.  
  163. /* Control/Status Call Codes */
  164. enum {
  165.     drvStsCode                    = 8,                            /* status call code for drive status */
  166.     ejectCode                    = 7,                            /* control call eject code */
  167.     tgBuffCode                    = 8                                /* set tag buffer code */
  168. };
  169.  
  170. /* miscellaneous Device Manager constants */
  171. enum {
  172.     ioInProgress                = 1,                            /* predefined value of ioResult while I/O is pending */
  173.     aRdCmd                        = 2,                            /* low byte of ioTrap for Read calls */
  174.     aWrCmd                        = 3,                            /* low byte of ioTrap for Write calls */
  175.     asyncTrpBit                    = 10,                            /* trap word modifier */
  176.     noQueueBit                    = 9                                /* trap word modifier */
  177. };
  178.  
  179. /* flags used in the driver header and device control entry */
  180. enum {
  181.     dReadEnable                    = 0,                            /* set if driver responds to read requests */
  182.     dWritEnable                    = 1,                            /* set if driver responds to write requests */
  183.     dCtlEnable                    = 2,                            /* set if driver responds to control requests */
  184.     dStatEnable                    = 3,                            /* set if driver responds to status requests */
  185.     dNeedGoodBye                = 4,                            /* set if driver needs time for performing periodic tasks */
  186.     dNeedTime                    = 5,                            /* set if driver needs time for performing periodic tasks */
  187.     dNeedLock                    = 6,                            /* set if driver must be locked in memory as soon as it is opened */
  188.     dNeedLockMask                = 0x4000,                        /* set if driver must be locked in memory as soon as it is opened */
  189.     dNeedTimeMask                = 0x2000,                        /* set if driver needs time for performing periodic tasks */
  190.     dNeedGoodByeMask            = 0x1000,                        /* set if driver needs to be called before the application heap is initialized */
  191.     dStatEnableMask                = 0x0800,                        /* set if driver responds to status requests */
  192.     dCtlEnableMask                = 0x0400,                        /* set if driver responds to control requests */
  193.     dWritEnableMask                = 0x0200,                        /* set if driver responds to write requests */
  194.     dReadEnableMask                = 0x0100                        /* set if driver responds to read requests */
  195. };
  196.  
  197. /* run-time flags used in the device control entry */
  198. enum {
  199.     dOpened                        = 5,                            /* driver is open */
  200.     dRAMBased                    = 6,                            /* dCtlDriver is a handle (1) or pointer (0) */
  201.     drvrActive                    = 7,                            /* driver is currently processing a request */
  202.     drvrActiveMask                = 0x0080,                        /* driver is currently processing a request */
  203.     dRAMBasedMask                = 0x0040,                        /* dCtlDriver is a handle (1) or pointer (0) */
  204.     dOpenedMask                    = 0x0020                        /* driver is open */
  205. };
  206.  
  207. struct DRVRHeader {
  208.     short                            drvrFlags;
  209.     short                            drvrDelay;
  210.     short                            drvrEMask;
  211.     short                            drvrMenu;
  212.     short                            drvrOpen;
  213.     short                            drvrPrime;
  214.     short                            drvrCtl;
  215.     short                            drvrStatus;
  216.     short                            drvrClose;
  217.     unsigned char                    drvrName[1];
  218. };
  219. typedef struct DRVRHeader DRVRHeader;
  220.  
  221. typedef DRVRHeader *DRVRHeaderPtr, **DRVRHeaderHandle;
  222.  
  223. struct DCtlEntry {
  224.     Ptr                                dCtlDriver;
  225.     short                            dCtlFlags;
  226.     QHdr                            dCtlQHdr;
  227.     long                            dCtlPosition;
  228.     Handle                            dCtlStorage;
  229.     short                            dCtlRefNum;
  230.     long                            dCtlCurTicks;
  231.     WindowPtr                        dCtlWindow;
  232.     short                            dCtlDelay;
  233.     short                            dCtlEMask;
  234.     short                            dCtlMenu;
  235. };
  236. typedef struct DCtlEntry DCtlEntry;
  237.  
  238. typedef DCtlEntry *DCtlPtr, **DCtlHandle;
  239.  
  240. struct AuxDCE {
  241.     Ptr                                dCtlDriver;
  242.     short                            dCtlFlags;
  243.     QHdr                            dCtlQHdr;
  244.     long                            dCtlPosition;
  245.     Handle                            dCtlStorage;
  246.     short                            dCtlRefNum;
  247.     long                            dCtlCurTicks;
  248.     GrafPtr                            dCtlWindow;
  249.     short                            dCtlDelay;
  250.     short                            dCtlEMask;
  251.     short                            dCtlMenu;
  252.     SInt8                            dCtlSlot;
  253.     SInt8                            dCtlSlotId;
  254.     long                            dCtlDevBase;
  255.     Ptr                                dCtlOwner;
  256.     SInt8                            dCtlExtDev;
  257.     SInt8                            fillByte;
  258.     UInt32                            dCtlNodeID;
  259. };
  260. typedef struct AuxDCE AuxDCE;
  261.  
  262. typedef AuxDCE *AuxDCEPtr, **AuxDCEHandle;
  263.  
  264. typedef UInt16 UnitNumber;
  265.  
  266. typedef UInt32 DriverOpenCount;
  267.  
  268. typedef SInt16 DriverRefNum;
  269.  
  270. typedef SInt16 DriverFlags;
  271.  
  272. typedef UInt32 IOCommandCode;
  273.  
  274.  
  275. enum {
  276.     kOpenCommand                = 0,
  277.     kCloseCommand                = 1,
  278.     kReadCommand                = 2,
  279.     kWriteCommand                = 3,
  280.     kControlCommand                = 4,
  281.     kStatusCommand                = 5,
  282.     kKillIOCommand                = 6,
  283.     kInitializeCommand            = 7,                            /* init driver and device*/
  284.     kFinalizeCommand            = 8,                            /* shutdown driver and device*/
  285.     kReplaceCommand                = 9,                            /* replace an old driver*/
  286.     kSupersededCommand            = 10                            /* prepare to be replaced by a new driver*/
  287. };
  288.  
  289. /*
  290.  * WARNING: These typedef was added for ETO 16 compatibility
  291.  */
  292. typedef struct OpaqueRef *KernelID, *AddressSpaceID;
  293. typedef UInt32 OptionBits;
  294. typedef UInt32 ItemCount;
  295.  
  296. typedef KernelID IOCommandID;
  297.  
  298. typedef UInt32 IOCommandKind;
  299.  
  300.  
  301. enum {
  302.     kSynchronousIOCommandKind    = 0x00000001,
  303.     kAsynchronousIOCommandKind    = 0x00000002,
  304.     kImmediateIOCommandKind        = 0x00000004
  305. };
  306.  
  307. struct DriverInitInfo {
  308.     DriverRefNum                    refNum;
  309.     RegEntryID                        deviceEntry;
  310. };
  311. struct DriverFinalInfo {
  312.     DriverRefNum                    refNum;
  313.     RegEntryID                        deviceEntry;
  314. };
  315. typedef struct DriverInitInfo DriverInitInfo, *DriverInitInfoPtr;
  316.  
  317. typedef struct DriverInitInfo DriverReplaceInfo, *DriverReplaceInfoPtr;
  318.  
  319. typedef struct DriverFinalInfo DriverFinalInfo, *DriverFinalInfoPtr;
  320.  
  321. typedef struct DriverFinalInfo DriverSupersededInfo, *DriverSupersededInfoPtr;
  322.  
  323. /* Contents are command specific*/
  324. union IOCommandContents {
  325.     ParmBlkPtr                        pb;
  326.     DriverInitInfoPtr                initialInfo;
  327.     DriverFinalInfoPtr                finalInfo;
  328.     DriverReplaceInfoPtr            replaceInfo;
  329.     DriverSupersededInfoPtr            supersededInfo;
  330. };
  331. typedef union IOCommandContents IOCommandContents;
  332.  
  333. typedef OSErr (DriverEntryPoint)(AddressSpaceID SpaceID, IOCommandID CommandID, IOCommandContents Contents, IOCommandCode Code, IOCommandKind Kind);
  334. typedef DriverEntryPoint *DriverEntryPointPtr;
  335.  
  336. /* Driver Typing Information Used to Match Drivers With Devices */
  337. struct DriverType {
  338.     Str31                            nameInfoStr;                /* Driver Name/Info String*/
  339.     NumVersion                        version;                    /* Driver Version Number*/
  340. };
  341. typedef struct DriverType DriverType, *DriverTypePtr;
  342.  
  343. /* OS Runtime Information Used to Setup and Maintain a Driver's Runtime Environment */
  344. typedef OptionBits RuntimeOptions;
  345.  
  346.  
  347. enum {
  348.     kDriverIsLoadedUponDiscovery = 0x00000001,                    /* auto-load driver when discovered*/
  349.     kDriverIsOpenedUponLoad        = 0x00000002,                    /* auto-open driver when loaded*/
  350.     kDriverIsUnderExpertControl    = 0x00000004,                    /* I/O expert handles loads/opens*/
  351.     kDriverIsConcurrent            = 0x00000008,                    /* supports concurrent requests*/
  352.     kDriverQueuesIOPB            = 0x00000010                    /* device manager doesn't queue IOPB*/
  353. };
  354.  
  355. struct DriverOSRuntime {
  356.     RuntimeOptions                    driverRuntime;                /* Options for OS Runtime*/
  357.     Str31                            driverName;                    /* Driver's name to the OS*/
  358.     UInt32                            driverDescReserved[8];        /* Reserved area*/
  359. };
  360. typedef struct DriverOSRuntime DriverOSRuntime, *DriverOSRuntimePtr;
  361.  
  362. /* OS Service Information Used To Declare What APIs a Driver Supports */
  363. typedef UInt32 ServiceCount;
  364.  
  365. struct DriverServiceInfo {
  366.     OSType                            serviceCategory;            /* Service Category Name*/
  367.     OSType                            serviceType;                /* Type within Category*/
  368.     NumVersion                        serviceVersion;                /* Version of service*/
  369. };
  370. typedef struct DriverServiceInfo DriverServiceInfo, *DriverServiceInfoPtr;
  371.  
  372. struct DriverOSService {
  373.     ServiceCount                    nServices;                    /* Number of Services Supported*/
  374.     DriverServiceInfo                service[1];                    /* The List of Services (at least one)*/
  375. };
  376. typedef struct DriverOSService DriverOSService, *DriverOSServicePtr;
  377.  
  378. /* Categories */
  379.  
  380. enum {
  381.     kServiceCategoryDisplay        = 'disp',                        /* Display Manager*/
  382.     kServiceCategoryOpenTransport = 'otan',                        /* Open Transport*/
  383.     kServiceCategoryBlockStorage = 'blok',                        /* Block Storage*/
  384.     kServiceCategoryNdrvDriver    = 'ndrv',                        /* Generic Native Driver*/
  385.     kServiceCategoryScsiSIM        = 'scsi'
  386. };
  387.  
  388. /* Ndrv ServiceCategory Types */
  389. enum {
  390.     kNdrvTypeIsGeneric            = 'genr',                        /* generic*/
  391.     kNdrvTypeIsVideo            = 'vido',                        /* video*/
  392.     kNdrvTypeIsBlockStorage        = 'blok',                        /* block storage*/
  393.     kNdrvTypeIsNetworking        = 'netw',                        /* networking*/
  394.     kNdrvTypeIsSerial            = 'serl',                        /* serial*/
  395.     kNdrvTypeIsSound            = 'sond',                        /* sound*/
  396.     kNdrvTypeIsBusBridge        = 'brdg'
  397. };
  398.  
  399. /*    The Driver Description */
  400. enum {
  401.     kTheDescriptionSignature    = 'mtej'
  402. };
  403.  
  404. typedef UInt32 DriverDescVersion;
  405.  
  406.  
  407. enum {
  408.     kInitialDriverDescriptor    = 0
  409. };
  410.  
  411. struct DriverDescription {
  412.     OSType                            driverDescSignature;        /* Signature field of this structure*/
  413.     DriverDescVersion                driverDescVersion;            /* Version of this data structure*/
  414.     DriverType                        driverType;                    /* Type of Driver*/
  415.     DriverOSRuntime                    driverOSRuntimeInfo;        /* OS Runtime Requirements of Driver*/
  416.     DriverOSService                    driverServices;                /* Apple Service API Membership*/
  417. };
  418. typedef struct DriverDescription DriverDescription, *DriverDescriptionPtr;
  419.  
  420. /* Record to describe a file-based driver candidate */
  421. struct FileBasedDriverRecord {
  422.     FSSpec                            theSpec;                    /* file specification*/
  423.     DriverType                        theType;                    /* nameInfoStr + version number*/
  424.     Boolean                            compatibleProp;                /* true if matched using a compatible name*/
  425.     UInt8                            pad[3];                        /* alignment*/
  426. };
  427. typedef struct FileBasedDriverRecord FileBasedDriverRecord, *FileBasedDriverRecordPtr;
  428.  
  429. /* Detailed Record to describe a file-based driver candidate. Includes fragment name */
  430. struct FileBasedDriverDetailed {
  431.     FileBasedDriverRecord             fileBasedDriver;
  432.     Str63                             fragName;
  433. };
  434. typedef struct FileBasedDriverDetailed FileBasedDriverDetailed;
  435. typedef FileBasedDriverDetailed *        FileBasedDriverDetailedPtr;
  436.  
  437. /* Driver Loader API */
  438. #define DECLARE_DRIVERDESCRIPTION(N_ADDITIONAL_SERVICES)  \
  439.     struct {                    \
  440.     DriverDescription    fixed;    \
  441.     DriverServiceInfo    additional_service[N_ADDITIONAL_SERVICES-1]; \
  442.     };
  443. extern SInt16 HigherDriverVersion(NumVersion *driverVersion1, NumVersion *driverVersion2);
  444. extern OSErr VerifyFragmentAsDriver(CFragConnectionID fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  445. extern OSErr GetDriverMemoryFragment(Ptr memAddr, long length, ConstStr63Param fragName, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  446. extern OSErr GetDriverDiskFragment(FSSpecPtr fragmentSpec, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  447. extern OSErr GetNamedDriverDiskFragment(FSSpecPtr fragmentSpec, ConstStr63Param fragName, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  448. extern OSErr InstallDriverFromFragment(CFragConnectionID fragmentConnID, RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  449. extern OSErr InstallDriverFromFile(FSSpecPtr fragmentSpec, RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  450. extern OSErr InstallDriverFromMemory(Ptr memory, long length, ConstStr63Param fragName, RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  451. extern OSErr InstallDriverFromDisk(Ptr theDriverName, RegEntryIDPtr theDevice, UnitNumber theBeginningUnit, UnitNumber theEndingUnit, DriverRefNum *theRefNum);
  452. extern OSErr FindDriversForDevice(RegEntryIDPtr device, FSSpec *fragmentSpec, DriverDescription *fileDriverDesc, Ptr *memAddr, long *length, StringPtr fragName, DriverDescription *memDriverDesc);
  453. extern OSErr FindDriverCandidates(RegEntryIDPtr deviceID, Ptr *propBasedDriver, RegPropertyValueSize *propBasedDriverSize, StringPtr deviceName, DriverType *propBasedDriverType, Boolean *gotPropBasedDriver, FileBasedDriverRecordPtr fileBasedDrivers, ItemCount *nFileBasedDrivers);
  454. extern OSErr ScanDriverCandidates(RegEntryIDPtr deviceID, FileBasedDriverRecordPtr fileBasedDrivers, ItemCount nFileBasedDrivers, FileBasedDriverRecordPtr matchingDrivers, ItemCount *nMatchingDrivers);
  455. extern OSErr ScanDriverCandidatesDetailed(RegEntryIDPtr deviceID, FileBasedDriverDetailedPtr fileBasedDrivers, ItemCount nFileBasedDrivers, FileBasedDriverDetailedPtr matchingDrivers, ItemCount *nMatchingDrivers);
  456. extern OSErr GetDriverForDevice(RegEntryIDPtr device, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescriptionPtr *driverDesc);
  457. extern OSErr InstallDriverForDevice(RegEntryIDPtr device, UnitNumber beginningUnit, UnitNumber endingUnit, DriverRefNum *refNum);
  458. extern OSErr SetDriverClosureMemory(CFragConnectionID fragmentConnID, Boolean holdDriverMemory);
  459. extern OSErr ReplaceDriverWithFragment(DriverRefNum theRefNum, CFragConnectionID fragmentConnID);
  460. extern OSErr GetDriverInformation(DriverRefNum refNum, UnitNumber *unitNum, DriverFlags *flags, DriverOpenCount *count, StringPtr name, RegEntryID *device, CFragHFSLocator *driverLoadLocation, CFragConnectionID *fragmentConnID, DriverEntryPointPtr *fragmentMain, DriverDescription *driverDesc);
  461. extern OSErr OpenInstalledDriver(DriverRefNum refNum, SInt8 ioPermission);
  462. extern OSErr RenameDriver(DriverRefNum refNum, StringPtr newDriverName);
  463. extern OSErr RemoveDriver(DriverRefNum refNum, Boolean immediate);
  464. extern OSErr LookupDrivers(UnitNumber beginningUnit, UnitNumber endingUnit, Boolean emptyUnits, ItemCount *returnedRefNums, DriverRefNum *refNums);
  465. extern UnitNumber HighestUnitNumber(void);
  466. extern OSErr DriverGestaltOn(DriverRefNum refNum);
  467. extern OSErr DriverGestaltOff(DriverRefNum refNum);
  468. extern Boolean DriverGestaltIsOn(DriverFlags flags);
  469. typedef pascal long (*ControlPanelDefProcPtr)(short message, short item, short numItems, short cPanelID, EventRecord *theEvent, long cdevValue, DialogPtr cpDialog);
  470.  
  471. #if GENERATINGCFM
  472. typedef UniversalProcPtr ControlPanelDefUPP;
  473. #else
  474. typedef ControlPanelDefProcPtr ControlPanelDefUPP;
  475. #endif
  476.  
  477. enum {
  478.     uppControlPanelDefProcInfo = kPascalStackBased
  479.          | RESULT_SIZE(SIZE_CODE(sizeof(long)))
  480.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  481.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  482.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
  483.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short)))
  484.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(EventRecord*)))
  485.          | STACK_ROUTINE_PARAMETER(6, SIZE_CODE(sizeof(long)))
  486.          | STACK_ROUTINE_PARAMETER(7, SIZE_CODE(sizeof(DialogPtr)))
  487. };
  488.  
  489. #if GENERATINGCFM
  490. #define NewControlPanelDefProc(userRoutine)        \
  491.         (ControlPanelDefUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppControlPanelDefProcInfo, GetCurrentArchitecture())
  492. #else
  493. #define NewControlPanelDefProc(userRoutine)        \
  494.         ((ControlPanelDefUPP) (userRoutine))
  495. #endif
  496.  
  497. #if GENERATINGCFM
  498. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog)        \
  499.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppControlPanelDefProcInfo, (message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  500. #else
  501. #define CallControlPanelDefProc(userRoutine, message, item, numItems, cPanelID, theEvent, cdevValue, cpDialog)        \
  502.         (*(userRoutine))((message), (item), (numItems), (cPanelID), (theEvent), (cdevValue), (cpDialog))
  503. #endif
  504.  
  505. extern pascal DCtlHandle GetDCtlEntry(short refNum);
  506. /*
  507.     SetChooserAlert used to simply set a bit in a low-mem global
  508.     to tell the Chooser not to display its warning message when
  509.     the printer is changed. However, under MultiFinder and System 7,
  510.     this low-mem is swapped out when a layer change occurs, and the
  511.     Chooser never sees the change. It is obsolete, and completely
  512.     unsupported on the PowerPC. 68K apps can still call it if they
  513.     wish.
  514. */
  515. #if OLDROUTINENAMES && !GENERATINGCFM
  516. extern pascal Boolean SetChooserAlert(Boolean f);
  517. #endif
  518.  
  519. #if !GENERATINGCFM
  520. #pragma parameter __D0 DriverInstall(__A0, __D0)
  521. #endif
  522. extern pascal OSErr DriverInstall(DRVRHeaderPtr drvrPtr, short refNum)
  523.  ONEWORDINLINE(0xA03D);
  524.  
  525. #if !GENERATINGCFM
  526. #pragma parameter __D0 DriverInstallReserveMem(__A0, __D0)
  527. #endif
  528. extern pascal OSErr DriverInstallReserveMem(DRVRHeaderPtr drvrPtr, short refNum)
  529.  ONEWORDINLINE(0xA43D);
  530. /*
  531.   Note: DrvrInstall() is no longer supported, becuase it never really worked anyways.
  532.           There will soon be a DriverInstall() which does the right thing.
  533.         
  534.         DrvrRemove has been renamed to DriverRemove.  But, InterfaceLib for PowerPC
  535.         still exports DrvrRemove, so a macro is used to map the new name to old.
  536.  
  537. */
  538.  
  539. #if !GENERATINGCFM
  540. #pragma parameter __D0 DrvrRemove(__D0)
  541. #endif
  542. extern pascal OSErr DrvrRemove(short refNum)
  543.  ONEWORDINLINE(0xA03E);
  544. #define DriverRemove(refNum) DrvrRemove(refNum)
  545. extern pascal OSErr OpenDriver(ConstStr255Param name, short *drvrRefNum);
  546. extern pascal OSErr CloseDriver(short refNum);
  547. extern pascal OSErr Control(short refNum, short csCode, const void *csParamPtr);
  548. extern pascal OSErr Status(short refNum, short csCode, void *csParamPtr);
  549. extern pascal OSErr KillIO(short refNum);
  550.  
  551. #if !GENERATINGCFM
  552. #pragma parameter __D0 PBControlSync(__A0)
  553. #endif
  554. extern pascal OSErr PBControlSync(ParmBlkPtr paramBlock)
  555.  ONEWORDINLINE(0xA004);
  556.  
  557. #if !GENERATINGCFM
  558. #pragma parameter __D0 PBControlAsync(__A0)
  559. #endif
  560. extern pascal OSErr PBControlAsync(ParmBlkPtr paramBlock)
  561.  ONEWORDINLINE(0xA404);
  562.  
  563. #if !GENERATINGCFM
  564. #pragma parameter __D0 PBControlImmed(__A0)
  565. #endif
  566. extern pascal OSErr PBControlImmed(ParmBlkPtr paramBlock)
  567.  ONEWORDINLINE(0xA204);
  568.  
  569. #if !GENERATINGCFM
  570. #pragma parameter __D0 PBStatusSync(__A0)
  571. #endif
  572. extern pascal OSErr PBStatusSync(ParmBlkPtr paramBlock)
  573.  ONEWORDINLINE(0xA005);
  574.  
  575. #if !GENERATINGCFM
  576. #pragma parameter __D0 PBStatusAsync(__A0)
  577. #endif
  578. extern pascal OSErr PBStatusAsync(ParmBlkPtr paramBlock)
  579.  ONEWORDINLINE(0xA405);
  580.  
  581. #if !GENERATINGCFM
  582. #pragma parameter __D0 PBStatusImmed(__A0)
  583. #endif
  584. extern pascal OSErr PBStatusImmed(ParmBlkPtr paramBlock)
  585.  ONEWORDINLINE(0xA205);
  586.  
  587. #if !GENERATINGCFM
  588. #pragma parameter __D0 PBKillIOSync(__A0)
  589. #endif
  590. extern pascal OSErr PBKillIOSync(ParmBlkPtr paramBlock)
  591.  ONEWORDINLINE(0xA006);
  592.  
  593. #if !GENERATINGCFM
  594. #pragma parameter __D0 PBKillIOAsync(__A0)
  595. #endif
  596. extern pascal OSErr PBKillIOAsync(ParmBlkPtr paramBlock)
  597.  ONEWORDINLINE(0xA406);
  598.  
  599. #if !GENERATINGCFM
  600. #pragma parameter __D0 PBKillIOImmed(__A0)
  601. #endif
  602. extern pascal OSErr PBKillIOImmed(ParmBlkPtr paramBlock)
  603.  ONEWORDINLINE(0xA206);
  604. extern pascal short OpenDeskAcc(ConstStr255Param deskAccName)
  605.  ONEWORDINLINE(0xA9B6);
  606. extern pascal void CloseDeskAcc(short refNum)
  607.  ONEWORDINLINE(0xA9B7);
  608. #if CGLUESUPPORTED
  609. extern short opendeskacc(const char *deskAccName);
  610. extern OSErr opendriver(const char *driverName, short *refNum);
  611. #endif
  612. #define PBControl(pb, async) ((async) ? PBControlAsync(pb) : PBControlSync(pb))
  613. #define PBStatus(pb, async) ((async) ? PBStatusAsync(pb) : PBStatusSync(pb))
  614. #define PBKillIO(pb, async) ((async) ? PBKillIOAsync(pb) : PBKillIOSync(pb))
  615.  
  616. #ifdef __CFM68K__
  617. #pragma import off
  618. #endif
  619.  
  620. #if GENERATINGPOWERPC
  621. #pragma options align=reset
  622. #endif
  623.  
  624. #ifdef __cplusplus
  625. }
  626. #endif
  627.  
  628. #endif /* __DEVICES__ */
  629.